package mysql.cs.command;

import mysql.Commond;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

/**
 * 1              [02] COM_INIT_DB
 * string[EOF]    schema name
 */
public class InitDBCommand extends Commond {
    private String dataabase;
    public InitDBCommand(){
        setCommand((byte)0x02);
    }
    @Override
    public void encode(byte[] data) {

    }

    @Override
    public byte[] decode() throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        out.write(getCommand());
        out.write(getDataabase().getBytes());
        return out.toByteArray();
    }

    public String getDataabase() {
        return dataabase;
    }

    public void setDataabase(String dataabase) {
        this.dataabase = dataabase;
    }
}